import 'package:auto_route/auto_route.dart';
import 'package:distribution_mall_flutter/assets.dart';
import 'package:distribution_mall_flutter/constant/image_constant.dart';
import 'package:distribution_mall_flutter/generated/l10n.dart';
import 'package:distribution_mall_flutter/utils/common_widget.dart';
import 'package:distribution_mall_flutter/utils/image_loader.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:url_launcher/url_launcher.dart';

@RoutePage()
class AfterSalePage extends ConsumerStatefulWidget {
  const AfterSalePage({super.key});

  @override
  ConsumerState<AfterSalePage> createState() => _AfterSalePageState();
}

class _AfterSalePageState extends ConsumerState<AfterSalePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: CommonBtnWidget.arrowBack(),
      ),
      body: Container(
        margin: const EdgeInsets.only(top: 10),
        width: double.infinity,
        child: SingleChildScrollView(
          child: Column(
            children: [
              Image.asset(
                Assets.assets_icons_after_sale_after_sale_png,
                width: 174,
              ),
              Image.asset(
                Assets.assets_icons_after_sale_after_sale_center_png,
                width: 250,
              ),
              Text(
                S.current.after_sale_1,
                textAlign: TextAlign.center,
                style: const TextStyle(fontSize: 14, color: Color(0xFF5A5A5C)),
              ),
              Container(
                margin: const EdgeInsets.only(top: 37, bottom: 18),
                child: Text(
                  S.current.after_sale_2,
                  textAlign: TextAlign.center,
                  style:
                      const TextStyle(fontSize: 16, color: Color(0xFF353A56)),
                ),
              ),
              GestureDetector(
                onTap: () {
                  launchUrl(Uri.parse('tel:09664634275'));
                },
                child: Container(
                  padding: const EdgeInsets.only(top: 26, bottom: 26),
                  width: double.infinity,
                  margin:
                      const EdgeInsets.only(left: 24, right: 24, bottom: 31),
                  decoration: BoxDecoration(
                    color: Color(0x24B6D4FA),
                    borderRadius: BorderRadius.circular(16),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Image.asset(
                        Assets.assets_icons_after_sale_after_sale_tel_png,
                        width: 28,
                      ),
                      const SizedBox(width: 8),
                      const Text(
                        '09664634275',
                        textAlign: TextAlign.center,
                        style:
                            TextStyle(fontSize: 24, color: Color(0xFF434445)),
                      ),
                    ],
                  ),
                ),
              ),
              ImageLoader.imageNet(ImageConstant.saleQrCode, width: 194),
              // Image.asset(
              //   Assets.assets_icons_http_sale_qr_code_png,
              //   width: 194,
              // ),
              Container(
                margin: const EdgeInsets.only(top: 16, bottom: 80),
                child: Text(
                  S.current.after_sale_3,
                  textAlign: TextAlign.center,
                  style:
                      const TextStyle(fontSize: 14, color: Color(0xFF5A5A5C)),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
